#include<bits/stdc++.h>
using namespace std;
int main() {
	string n, t;
	cin >> n;
	while (n != "495") {
		sort(n.begin(), n.end());
		t = n;
		reverse(n.begin(), n.end());
		string ans = to_string(atoi(n.c_str()) - atoi(t.c_str()));
		if (ans.size() != 3)
			ans = "0" + ans;
		cout << n + "-" + t + "=" + ans << endl;
		n = ans;
	}
	return 0;
}

